# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=dbus-glib
pkgver=0.112
pkgrel=3
pkgdesc='GLib bindings for D-Bus (deprecated)'
arch=('loong64' 'x86_64')
url='https://www.freedesktop.org/wiki/Software/dbus/'
license=('GPL')
depends=('dbus' 'expat' 'glib2' 'glibc')
makedepends=('python')
source=("https://dbus.freedesktop.org/releases/$pkgname/$pkgname-$pkgver.tar.gz"{,.asc}
        'dbus-glib-bash-completion.patch::https://gitlab.freedesktop.org/dbus/dbus-glib/-/merge_requests/5.patch')
sha256sums=('7d550dccdfcd286e33895501829ed971eeb65c614e73aadb4a08aeef719b143a'
            'SKIP'
            'edbdd4fb5fce358b427da1a1c68347ce09ca444da6ac67ff1fcd6cc67fc92f99')
validpgpkeys=('DA98F25C0871C49A59EAFF2C4DE8FF2A63C7CC90')

prepare() {
  patch -d $pkgname-$pkgver -Np1 -i ../dbus-glib-bash-completion.patch # Fix bash completion
}

build() {
  cd $pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --enable-tests
  make
}

check() {
  cd $pkgname-$pkgver
  make check
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install completiondir='$(datadir)/bash-completion/completions'
  mv "$pkgdir/usr/share/bash-completion/completions/"{dbus-bash-completion.sh,dbus-send}
}
